//
//  WDAppointTimeView.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/29.
//

#import "WDAppointTimeView.h"
#import "WDArrivalServiceDetailModel.h"


@interface WDAppointTimeView ()

@property (nonatomic, strong) WDArrivalServiceDetailModel *taskDetailModel;

@property (nonatomic, strong) UILabel *timeLabel;

@end

@implementation WDAppointTimeView

- (void)initWithVar {
    [super initWithVar];
    
}

- (void)initWithSubView {
    [super initWithSubView];
    self.backgroundColor = [UIColor colorWithHexString:@"#D6FFEB"];
}

- (void)initWithTimeLabel {
    if (!_timeLabel) {
        CGRect frame = CGRectMake(20, (self.height - 30) * 0.5, self.width - 40, 30);
        _timeLabel = [UILabel createWithLabel:self frame:frame font:FONTSIZE(14) propertiesBlock:^(UILabel * _Nonnull label) {
            
        }];
    }
    if (self.taskDetailModel) {
        NSString *str = objectNull(self.taskDetailModel.appointmentTime);
        if ([str isEqualToString:@""]) {
            str = objectNull(self.taskDetailModel.createTime);
            if ([str isEqualToString:@""]) {
                str = @"--";
            }
            
        }
        self.timeLabel.attributedText = [EDSUtility attributeTitle:@"预约时间：" titleColor:kThemeColor titleFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium] value:str valueColor:kThemeColor valueFont:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium]];
    }
}

- (void)updateWithViewData:(id)data {
    self.taskDetailModel = data;
    
    [self initWithTimeLabel];
}

@end
